from django.db import models

# Create your models here.
class Useres(models.Model):
    username=models.CharField(max_length=16,verbose_name='用户名')
    password=models.CharField(max_length=128,verbose_name='密码')
    mobile=models.CharField(max_length=16,verbose_name='手机号')
    grad = models.IntegerField(default=6, verbose_name='等级')
    img = models.CharField(default='http://127.0.0.1:8000/static/tu1.jpg/', max_length=128, verbose_name='头像')
    count = models.IntegerField(default=20, verbose_name='发布的动态数量')
    fans = models.IntegerField(default=10000, verbose_name='粉丝数量')
    att = models.IntegerField(default=50, verbose_name='用户关注人数')
    class Meta:
        db_table='users'
        verbose_name='用户表'
        verbose_name_plural=verbose_name
    def __str__(self):
        return self.username




class Massage(models.Model):
    name = models.CharField(max_length=16, verbose_name='昵称')
    singn= models.CharField(max_length=16, verbose_name='歌手')
    class Meta:
        db_table='massages'
        verbose_name='个人信息'
        verbose_name_plural=verbose_name
    def __str__(self):
        return self.name


# 歌单类
class Catesingn(models.Model):
      gedan=models.CharField(max_length=16, verbose_name='创建歌单类')
      class Meta:
          db_table = 'singes'
          verbose_name = '创建歌单'
          verbose_name_plural = verbose_name

      def __str__(self):
          return self.gedan

# 歌单具体
class Showall(models.Model):
    name = models.CharField(max_length=16, verbose_name='昵称')
    singn = models.CharField(max_length=16, verbose_name='歌手')
    shichang=models.CharField(max_length=50,verbose_name='时长')
    # user = models.ForeignKey(Useres, on_delete=models.CASCADE, verbose_name='用户')
    class Meta:
        db_table = 'showalls'
        verbose_name = '展示歌单类'
        verbose_name_plural = verbose_name

    def __str__(self):
        return self.name
class CollectModel(models.Model):
    showall=models.ForeignKey(Showall,on_delete=models.CASCADE,verbose_name='歌曲名')
    user=models.ForeignKey(Useres,on_delete=models.CASCADE,verbose_name='用户')
    collect_data=models.DateField(auto_now_add=True,verbose_name='添加时间')
    class Meta:
        db_table='collect'
        verbose_name='收藏表'
        verbose_name_plural=verbose_name

    def __str__(self):
        return '%s收藏的歌曲id是%s'%(self.user,self.showall)



class Cate(models.Model):
    kind=models.CharField(max_length=16,verbose_name='歌单种类')
    class Meta:
        db_table = 'kinds'
        verbose_name = '歌单种类'
        verbose_name_plural = verbose_name

    def __str__(self):
        return self.kind

class Bangdan(models.Model):
    name = models.CharField(max_length=16, verbose_name='昵称')
    singn = models.CharField(max_length=16, verbose_name='歌手')
    shichang = models.CharField(max_length=50, verbose_name='时长')
    cate=models.ForeignKey(Cate,on_delete=models.CASCADE,verbose_name='所属歌单种类')
    class Meta:
        db_table = 'bangdan'
        verbose_name = '榜单表'
        verbose_name_plural = verbose_name

    def __str__(self):
        return self.name









